xen/shim: crash instead of reboot in shim mode
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 11 Jan 2018 11:41:21 +0000 (11:41 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 16 Jan 2018 18:34:05 +0000 (18:34 +0000)
All guest shutdown operations are forwarded to L0, so the only native
calls to machine_restart happen from crash related paths inside the
hypervisor, hence switch the reboot code to instead issue a crash
shutdown.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
[ wei: fix arm build ]
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/shutdown.c
xen/drivers/char/console.c

index 689f6f137dc474fe46857e5295454b05c79beed1..a35071431951b7a4113de3abd4f2744ae9e39309 100644 (file)
@@ -642,7 +642,12 @@ void machine_restart(unsigned int delay_millisecs)
             break;
 
         case BOOT_XEN:
-            xen_hypercall_shutdown(SHUTDOWN_reboot);
+            /*
+             * When running in PV shim mode guest shutdown calls are
+             * forwarded to L0, hence the only way to get here is if a
+             * shim crash happens.
+             */
+            xen_hypercall_shutdown(pv_shim ? SHUTDOWN_crash : SHUTDOWN_reboot);
             break;
         }
     }
index 18f5b7f7aa2c16ef5cb186537898ea3a7070aa0a..121073c8eda7c6fda261688b210a82e52f7a6acc 100644 (file)
@@ -1253,7 +1253,11 @@ void panic(const char *fmt, ...)
     if ( opt_noreboot )
         printk("Manual reset required ('noreboot' specified)\n");
     else
+#ifdef CONFIG_X86
+        printk("%s in five seconds...\n", pv_shim ? "Crash" : "Reboot");
+#else
         printk("Reboot in five seconds...\n");
+#endif
 
     spin_unlock_irqrestore(&lock, flags);